home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume15 / mush6.2.pch < prev    next >
Encoding:
Internet Message Format  |  1988-05-22  |  43.7 KB

  1. Subject:  v15i106:  Upgrade kit for Mush release 6.2
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: dheller@cory.Berkeley.EDU (Dan Heller)
  6. Posting-number: Volume 15, Issue 106
  7. Archive-name: mush6.2.pch
  8.  
  9. [  This adds some date sorting, and fixes IO flushing on some systems,
  10.    as well as other stuff, no doubt.  -r$ ]
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of shell archive."
  19. # Contents:  README-6.2 Diffs-6.2
  20. # Wrapped by rsalz@fig.bbn.com on Mon May 23 18:41:06 1988
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'README-6.2' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'README-6.2'\"
  24. else
  25. echo shar: Extracting \"'README-6.2'\" \(3118 characters\)
  26. sed "s/^X//" >'README-6.2' <<'END_OF_FILE'
  27. main.c --
  28. X    New command line argument "-F file".  The file is sourced after
  29. X    the folder has been read in.  There have been requests to allow
  30. X    commands which manipulate messages to be in the .mushrc, but since
  31. X    that can't be done without being able to expand possible shell
  32. X    arguments such as "+folder", an additional source file can be
  33. X    executed before IO to the user happens by specifying this filename.
  34. X    If the flag given is "-F!", then the mush will exit once it is
  35. X    finished with the commands in the file.
  36. X
  37. main.c, mail.c, viewopts.c --
  38. X    A new variable called "tmpdir" has been added.  This path describes
  39. X    the location for all temporary files that mush creates.  If not set,
  40. X    mush will use the user's home directory.  If neither is accessible
  41. X    and writeable, then /tmp (defined in config.h) is used.
  42. X
  43. misc.c --
  44. X    when invoking a pager, sometimes cbreak was not getting set.  It
  45. X    wasn't easily reproducable because of a race condition set by a
  46. X    system call.
  47. X
  48. pick.c --
  49. X    There is a new option to the "pick" command called -ago.  Now you
  50. X    can pick messages relative to today's date.
  51. X    pick -ago 2 weeks
  52. X    will find all messages two weeks old.  The + and - modifiers will
  53. X    extend time searches:
  54. X
  55. X    pick -ago +2 days
  56. X    will find all messages from two days ago to current.
  57. X
  58. X    pick -ago -1w
  59. X
  60. X    will find all messages fromk one week ago and back.  You can specify
  61. X    days, weeks, months and years and the xyntax is extremely simple.
  62. X
  63. X    pick -ago 2 weeks 1 day
  64. X    pick -ago 1d 2w
  65. X    pick -ago 1 DAY, 2 WEEKS
  66. X    pick -a 1d2w
  67. X
  68. X    are all equivalent.  Note that months map to 30.5 days so March may
  69. X    be confusing.
  70. X
  71. X    The -d option to pick used to specify that dates preceded by '-' meant
  72. X    "on or before" and if there was no '-', then it defaulted to "on or after."
  73. X    It was difficult to find messages on a specific date only.  So now, the
  74. X    change is that "on or after" is specified by preceding a '+' before the
  75. X    date.  thus,
  76. X
  77. X    pick -d 5/2
  78. X
  79. X    *used* to find messages dated on or after May 2.  Now, it only finds
  80. X    messages on May 2 only.  To do messages on or after May 2, specify:
  81. X
  82. X    pick -d +5/2
  83. X
  84. help.c --
  85. X    help now sends output thru the internal pager in case the
  86. X    help message is very long.  pick -? may be the only problem, but now
  87. X    it's set up to handle arbitrarily long help messages.
  88. X
  89. mail.c --
  90. X    New mail checks happen while editing a message.  If you are sending
  91. X    mail to someone and new mail comes in (and you're not in your editor),
  92. X    then it will be incorporated immediately.
  93. X
  94. X    You can specify the internal pager use "~p internal" while editing
  95. X    a message.
  96. X
  97. X    Autosigning now precedes the singature file with "\n-- \n" for
  98. X    compaitibility with news and other programs.
  99. X
  100. execute.c --
  101. X    A "synxtax" type error would cause xenix systems to incorrectly
  102. X    evaluate the wait() loop.  The change:
  103. X    while ((pid = wait(&status) != -1) && ...
  104. X    has been changed to:
  105. X    while ((pid = wait(&status)) != -1 && ...
  106. X
  107. mush.1 --
  108. X    The man page has been updated as well to reflect the above changes.
  109. END_OF_FILE
  110. if test 3118 -ne `wc -c <'README-6.2'`; then
  111.     echo shar: \"'README-6.2'\" unpacked with wrong size!
  112. fi
  113. # end of 'README-6.2'
  114. fi
  115. if test -f 'Diffs-6.2' -a "${1}" != "-c" ; then 
  116.   echo shar: Will not clobber existing file \"'Diffs-6.2'\"
  117. else
  118. echo shar: Extracting \"'Diffs-6.2'\" \(38618 characters\)
  119. sed "s/^X//" >'Diffs-6.2' <<'END_OF_FILE'
  120. X*** OLD/cmd_help    Wed Mar  2 12:05:28 1988
  121. X--- cmd_help    Wed May 11 14:06:12 1988
  122. X***************
  123. X*** 174,193 ****
  124. X  %%
  125. X  
  126. X  %pick%
  127. X! use: pick [-r msg_list] [-d [-][date] ] [-s|f|t]] [-x] [-i] [-h hdr] [<pat>]
  128. X  Search for patterns within messages. Entire messages are searched
  129. X  for <pattern> unless -s, -f, -t, or -h is specified.
  130. X! Only one of -s, -f, -t, -d and -h can be specified at once.
  131. X  -r msg_list  restrict the range of messages search to msg_list
  132. X- -d: print message headers on or after [`-' before] `date' (no patterns).
  133. X  -h hdr   requires a header to be searched for.  Pattern searched in that hdr.
  134. X!      `date' is of the form: month/date/year
  135. X        Omitted fields default to today's values. Examples:
  136. X!       pick -d 4/20     msgs on or after Apr 20, this year
  137. X        pick -d -/2/85   on or before the 2nd, this month, 1985
  138. X!       pick -d /        finds today's messages only.
  139. X      At least one `/' char must be used in date.
  140. X      There is no strong date checking; 2/30 would be considered valid
  141. X  -s search for pattern in the "subject" headers only.
  142. X  -f search for pattern in the "from" field (author) only.
  143. X  -t search for pattern in the "to" field.
  144. X--- 174,196 ----
  145. X  %%
  146. X  
  147. X  %pick%
  148. X! use: pick [-r msg_list] [-d [-][date] ] [-s|f|t]] [-x] [-i]
  149. X!       [-h hdr] [-ago [n days] [n weeks] [n months] ] [<pat>]
  150. X  Search for patterns within messages. Entire messages are searched
  151. X  for <pattern> unless -s, -f, -t, or -h is specified.
  152. X! Only one of -s, -f, -t, -d, -ago and -h can be specified at once.
  153. X  -r msg_list  restrict the range of messages search to msg_list
  154. X  -h hdr   requires a header to be searched for.  Pattern searched in that hdr.
  155. X! -d: print headers on or [+ after] [- before] `date' (no pattern search).
  156. X!      `date' is of the form: [+-] [month]/[date/year]
  157. X        Omitted fields default to today's values. Examples:
  158. X!       pick -d 4/20     messages on Apr 20, this year
  159. X        pick -d -/2/85   on or before the 2nd, this month, 1985
  160. X!       pick -d +5/4     on or after May 4, this year
  161. X!       pick -d /        finds today's messages only
  162. X      At least one `/' char must be used in date.
  163. X      There is no strong date checking; 2/30 would be considered valid
  164. X+ -ago search for messages relative to the current date (see manual).
  165. X  -s search for pattern in the "subject" headers only.
  166. X  -f search for pattern in the "from" field (author) only.
  167. X  -t search for pattern in the "to" field.
  168. X*** OLD/commands.c    Thu May 12 13:51:57 1988
  169. X--- commands.c    Wed May 11 21:47:30 1988
  170. X***************
  171. X*** 752,758 ****
  172. X  {
  173. X      char **e;
  174. X      for (e = environ; *e; e++)
  175. X!     if (argc < 1 || !strncmp(*e, argv[1]))
  176. X          wprint("%s\n", *e);
  177. X      return -1;
  178. X  }
  179. X--- 752,758 ----
  180. X  {
  181. X      char **e;
  182. X      for (e = environ; *e; e++)
  183. X!     if (argc < 2 || !strncmp(*e, argv[1]))
  184. X          wprint("%s\n", *e);
  185. X      return -1;
  186. X  }
  187. X*** OLD/curs_io.c    Mon Mar  7 14:57:23 1988
  188. X--- curs_io.c    Wed May 11 20:38:32 1988
  189. X***************
  190. X*** 135,140 ****
  191. X--- 135,141 ----
  192. X          Addch(c);
  193. X      }
  194. X      }
  195. X+     fflush(stdout); /* for sys-v folks */
  196. X      if (c == CTRL(D) || c == EOF || ison(glob_flags, WAS_INTR)) {
  197. X      if (feof(stdin))
  198. X          clearerr(stdin);
  199. X*** OLD/curses.c    Thu May 12 13:52:00 1988
  200. X--- curses.c    Wed May 11 10:39:41 1988
  201. X***************
  202. X*** 718,724 ****
  203. X      int n;
  204. X  
  205. X      for (n = 0; n < COLS; n++)
  206. X!     if ((buf = mvinch(curline, n) & A_CHARTEXT) == '\0')
  207. X          break;
  208. X      buf[n] = '\0';
  209. X  #endif /* A_CHARTEXT */
  210. X--- 718,724 ----
  211. X      int n;
  212. X  
  213. X      for (n = 0; n < COLS; n++)
  214. X!     if ((buf = mvinch(line, n) & A_CHARTEXT) == '\0')
  215. X          break;
  216. X      buf[n] = '\0';
  217. X  #endif /* A_CHARTEXT */
  218. X*** OLD/execute.c    Sat Apr  2 16:14:19 1988
  219. X--- execute.c    Wed May 11 16:17:13 1988
  220. X***************
  221. X*** 68,74 ****
  222. X       * if other forks die (sendmail), then this wait will catch them,
  223. X       * This loop will really get -1, cuz sigchldcatcher will catch all else.
  224. X       */
  225. X!     while ((pid = wait(&status) != -1) && pid != exec_pid)
  226. X      Debug("The exec loop caught a signal? (pid = %d)\n", pid);
  227. X      /* reset our ttymodes */
  228. X      echo_off();
  229. X--- 68,74 ----
  230. X       * if other forks die (sendmail), then this wait will catch them,
  231. X       * This loop will really get -1, cuz sigchldcatcher will catch all else.
  232. X       */
  233. X!     while ((pid = wait(&status)) != -1 && pid != exec_pid)
  234. X      Debug("The exec loop caught a signal? (pid = %d)\n", pid);
  235. X      /* reset our ttymodes */
  236. X      echo_off();
  237. X*** OLD/help.c    Mon Dec  7 18:37:47 1987
  238. X--- help.c    Wed May 11 16:08:07 1988
  239. X***************
  240. X*** 72,77 ****
  241. X--- 72,79 ----
  242. X  #include <sys/types.h>
  243. X  #define wprint printf
  244. X  #define print  printf
  245. X+ #define TRUE   1
  246. X+ #define FALSE  0
  247. X  
  248. X  #endif /* SUNTOOL */
  249. X  
  250. X***************
  251. X*** 311,320 ****
  252. X      if (height == MAXLINES - 1)
  253. X      print("Help message is too long!\n");
  254. X  
  255. X      for (n = 0; n < height; n++) {
  256. X      (void) no_newln(args[n]);
  257. X!     wprint("%s\n", args[n]);
  258. X      }
  259. X  
  260. X      return 0;
  261. X  }
  262. X--- 313,326 ----
  263. X      if (height == MAXLINES - 1)
  264. X      print("Help message is too long!\n");
  265. X  
  266. X+     do_pager(NULL, TRUE);
  267. X      for (n = 0; n < height; n++) {
  268. X      (void) no_newln(args[n]);
  269. X!     (void) do_pager(args[n], FALSE);
  270. X!     if (do_pager("\n", FALSE) == EOF)
  271. X!         break;
  272. X      }
  273. X+     do_pager(NULL, FALSE);
  274. X  
  275. X      return 0;
  276. X  }
  277. X*** OLD/loop.c    Thu May 12 13:52:05 1988
  278. X--- loop.c    Wed May 11 21:31:42 1988
  279. X***************
  280. X*** 106,112 ****
  281. X      if (Getstr(line, sizeof(line), 0) > -1)
  282. X          p = line;
  283. X      else {
  284. X!         if (p = do_set(set_options, "ignoreeof")) {
  285. X          if (!*p)
  286. X              continue;
  287. X          else
  288. X--- 106,112 ----
  289. X      if (Getstr(line, sizeof(line), 0) > -1)
  290. X          p = line;
  291. X      else {
  292. X!         if (isatty(0) && (p = do_set(set_options, "ignoreeof"))) {
  293. X          if (!*p)
  294. X              continue;
  295. X          else
  296. X*** OLD/mail.c    Sat May 21 10:53:59 1988
  297. X--- mail.c    Sat May 21 10:56:08 1988
  298. X***************
  299. X*** 10,17 ****
  300. X   *    mail_someone()    called from do_mail() or from the shell.
  301. X   *    add_to_letter()    adds the next line to letter --determine ~ escapes.
  302. X   *    finish_up_letter()  prompts for Cc:, verifies user really wants to send
  303. X!  *    send_it()        invokes mailer, sends to record file, adds signature,
  304. X!  *            fortune, expands aliases, adds own_hdrs.
  305. X   *    rm_edfile()    signals are directed here. remove letter, longjmp
  306. X   *
  307. X   * The flow of control in this file is NOT obvious to allow for both text
  308. X--- 10,18 ----
  309. X   *    mail_someone()    called from do_mail() or from the shell.
  310. X   *    add_to_letter()    adds the next line to letter --determine ~ escapes.
  311. X   *    finish_up_letter()  prompts for Cc:, verifies user really wants to send
  312. X!  *    send_it()        invokes mailer, sends to record file, expands aliases,
  313. X!  *            adds own_hdrs.
  314. X!  *    sign_letter()    adds signature and fortunes.
  315. X   *    rm_edfile()    signals are directed here. remove letter, longjmp
  316. X   *
  317. X   * The flow of control in this file is NOT obvious to allow for both text
  318. X***************
  319. X*** 283,296 ****
  320. X  start_file(list)
  321. X  char *list;
  322. X  {
  323. X!     register char  *home;
  324. X      register int   i;
  325. X      char         line[MAXPATHLEN];
  326. X  
  327. X!     if (!(home = do_set(set_options, "home")) || !*home)
  328. X  alted:
  329. X!     home = ALTERNATE_HOME;
  330. X!     (void) mktemp(sprintf(line, "%s/%s", home, EDFILE));
  331. X      strdup(edfile, line);
  332. X      {
  333. X      int omask = umask(077);
  334. X--- 284,298 ----
  335. X  start_file(list)
  336. X  char *list;
  337. X  {
  338. X!     register char  *dir;
  339. X      register int   i;
  340. X      char         line[MAXPATHLEN];
  341. X  
  342. X!     if (!(dir = do_set(set_options, "tmpdir")) &&
  343. X!     !(dir = do_set(set_options, "home")))
  344. X  alted:
  345. X!     dir = ALTERNATE_HOME;
  346. X!     (void) mktemp(sprintf(line, "%s/%s", dir, EDFILE));
  347. X      strdup(edfile, line);
  348. X      {
  349. X      int omask = umask(077);
  350. X***************
  351. X*** 297,303 ****
  352. X      ed_fp = fopen(edfile, "w+");
  353. X      (void) umask(omask);
  354. X      if (!ed_fp) {
  355. X!         if (home != ALTERNATE_HOME)
  356. X          goto alted;
  357. X  #ifdef SUNTOOL
  358. X          if (istool)
  359. X--- 299,305 ----
  360. X      ed_fp = fopen(edfile, "w+");
  361. X      (void) umask(omask);
  362. X      if (!ed_fp) {
  363. X!         if (dir != ALTERNATE_HOME)
  364. X          goto alted;
  365. X  #ifdef SUNTOOL
  366. X          if (istool)
  367. X***************
  368. X*** 407,415 ****
  369. X       * be cleared cuz it's a new call.
  370. X       */
  371. X      (void) setjmp(cntrl_c_buf);
  372. X!     while (Getstr(line, sizeof(line), 0) > -1)
  373. X          if ((i = add_to_letter(line)) <= 0)
  374. X          break;
  375. X      } while (i >= 0 && !finish_up_letter());
  376. X      return i; /* return -1 if ~x or ~q to terminate letter */
  377. X  }
  378. X--- 409,419 ----
  379. X       * be cleared cuz it's a new call.
  380. X       */
  381. X      (void) setjmp(cntrl_c_buf);
  382. X!     while (Getstr(line, sizeof(line), 0) > -1) {
  383. X!         (void) check_new_mail(); /* if new mail comes in, get it */
  384. X          if ((i = add_to_letter(line)) <= 0)
  385. X          break;
  386. X+     }
  387. X      } while (i >= 0 && !finish_up_letter());
  388. X      return i; /* return -1 if ~x or ~q to terminate letter */
  389. X  }
  390. X***************
  391. X*** 513,519 ****
  392. X          if (!*p || *p == 'i' && !p[1])
  393. X          switch (line[1]) {
  394. X              case 'p' :
  395. X!             if (!(p = do_set(set_options, "pager")))
  396. X                  p = DEF_PAGER;
  397. X              if (!*p || !strcmp(p, "internal"))
  398. X                  p = NULL;
  399. X--- 517,523 ----
  400. X          if (!*p || *p == 'i' && !p[1])
  401. X          switch (line[1]) {
  402. X              case 'p' :
  403. X!             if (!*p && !(p = do_set(set_options, "pager")))
  404. X                  p = DEF_PAGER;
  405. X              if (!*p || !strcmp(p, "internal"))
  406. X                  p = NULL;
  407. X***************
  408. X*** 1043,1049 ****
  409. X      /* Sign the letter before adding the Bcc list since they aren't
  410. X       * considered when adding a signature.
  411. X       */
  412. X!     if (ison(flags, SIGN) && isoff(glob_flags, REDIRECT))
  413. X      sign_letter(addr_list);
  414. X  
  415. X      if (*Bcc) {
  416. X--- 1047,1054 ----
  417. X      /* Sign the letter before adding the Bcc list since they aren't
  418. X       * considered when adding a signature.
  419. X       */
  420. X!     if ((ison(flags, SIGN) || ison(flags, FORTUNE)) &&
  421. X!     isoff(glob_flags, REDIRECT) && isoff(flags, FORWARD))
  422. X      sign_letter(addr_list);
  423. X  
  424. X      if (*Bcc) {
  425. X***************
  426. X*** 1351,1357 ****
  427. X  register char *list; /* list of addresses -- no comment fields */
  428. X  {
  429. X      char buf[BUFSIZ];
  430. X!     register char *p, *p2, *signature, *addr;
  431. X      FILE     *pp2;
  432. X      int     lines = 0;
  433. X  
  434. X--- 1356,1362 ----
  435. X  register char *list; /* list of addresses -- no comment fields */
  436. X  {
  437. X      char buf[BUFSIZ];
  438. X!     register char *p = NULL, *p2, *signature, *addr;
  439. X      FILE     *pp2;
  440. X      int     lines = 0;
  441. X  
  442. X***************
  443. X*** 1358,1424 ****
  444. X      buf[0] = 0;
  445. X      while (isspace(*list))
  446. X      list++;
  447. X!     if (p = do_set(set_options, "autosign2")) {
  448. X!     if (!(signature = index(p, ':')))
  449. X!         wprint("\"autosign2\" incorrectly set (missing `:').\n");
  450. X!     else {
  451. X!         int ret_val = 0;
  452. X!         *signature = 0;
  453. X!         /* p now points to a list of addresses and p2 points to the
  454. X!          * signature format to use. Check that each address contains
  455. X!          * the stuff in alternate sign.
  456. X!          */
  457. X!         skipspaces(0);
  458. X!         if (!*p)
  459. X!         /* autosign2 = " : <signature>"  send to all recipients */
  460. X!         ret_val = 1;
  461. X!         else if (p = alias_to_address(p)) {
  462. X!         rm_cmts_in_addr(p);
  463. X!         for (addr = list;;) {
  464. X!             char c;
  465. X!             if (p2 = any(addr, ", ")) {
  466. X!             c = *p2;
  467. X!             *p2 = 0;
  468. X              }
  469. X-             ret_val = chk_two_lists(addr, p, ", ");
  470. X-             if (p2)
  471. X-             for (*p2++ = c; isspace(*p2) || *p2 == ','; p2++)
  472. X-                 ;
  473. X-             if (!ret_val || !(addr = p2))
  474. X-             break;
  475. X          }
  476. X          }
  477. X-         *signature++ = ':'; /* must reset first! */
  478. X-         if (ret_val) {
  479. X-         while (isspace(*signature))
  480. X-             signature++;
  481. X-         if (!*strcpy(buf, signature))
  482. X-             return;
  483. X-         }
  484. X      }
  485. X!     }
  486. X!     if (!buf[0]) {
  487. X!     if (!(p = do_set(set_options, "autosign")) || !*p) {
  488. X!         char *home;
  489. X!         if (!(home = do_set(set_options, "home")) || !*home)
  490. X!         home = ALTERNATE_HOME;
  491. X!         (void) sprintf(buf, "%s/%s", home, SIGNATURE);
  492. X      } else
  493. X!         (void) strcpy(buf, p);
  494. X!     wprint("Signing letter... ");
  495. X!     } else
  496. X!     wprint("Using alternate signature... ");
  497. X!     fputc('\n', ed_fp), fflush(ed_fp);
  498. X!     (void) fseek(ed_fp, 0L, 2); /* guarantee position at end of file */
  499. X!     if (*buf == '$')
  500. X!     if (!(p = do_set(set_options, buf)))
  501. X!         wprint("(%s isn't set -- letter not signed)\n", buf);
  502. X      else
  503. X!         fprintf(ed_fp, "%s\n", p), wprint("\n"), fflush(ed_fp);
  504. X!     else if (*buf == '\\')
  505. X!     fprintf(ed_fp, "%s\n", buf+1), wprint("\n"), fflush(ed_fp);
  506. X!     else
  507. X!     file_to_fp(buf, ed_fp, "r");
  508. X  
  509. X      /* if fortune is set, check to see if fortunates is set. If so,
  510. X       * check to see if all the recipient are on the fortunates list.
  511. X--- 1363,1431 ----
  512. X      buf[0] = 0;
  513. X      while (isspace(*list))
  514. X      list++;
  515. X!     if (ison(flags, SIGN)) {
  516. X!     if (p = do_set(set_options, "autosign2")) {
  517. X!         if (!(signature = index(p, ':')))
  518. X!         (void) strcpy(buf, p); /* No colon; use entire string as sig */
  519. X!         else {
  520. X!         int ret_val = 0;
  521. X!         *signature = 0;
  522. X!         /* p now points to a list of addresses and p2 points to the
  523. X!          * signature format to use. Check that each address contains
  524. X!          * the stuff in alternate sign.
  525. X!          */
  526. X!         skipspaces(0);
  527. X!         if (!*p)
  528. X!             /* autosign2 = " : <signature>"  send to all recipients */
  529. X!             ret_val = 1;
  530. X!         else if (p = alias_to_address(p)) {
  531. X!             rm_cmts_in_addr(p);
  532. X!             for (addr = list;;) {
  533. X!             char c;
  534. X!             if (p2 = any(addr, ", ")) {
  535. X!                 c = *p2;
  536. X!                 *p2 = 0;
  537. X!             }
  538. X!             ret_val = chk_two_lists(addr, p, ", ");
  539. X!             if (p2)
  540. X!                 for (*p2++ = c; isspace(*p2) || *p2 == ','; p2++)
  541. X!                 ;
  542. X!             if (!ret_val || !(addr = p2))
  543. X!                 break;
  544. X              }
  545. X          }
  546. X+         *signature++ = ':'; /* must reset first! */
  547. X+         if (ret_val) {
  548. X+             while (isspace(*signature))
  549. X+             signature++;
  550. X+             if (!*strcpy(buf, signature))
  551. X+             return;
  552. X+         }
  553. X          }
  554. X      }
  555. X!     if (!buf[0]) {
  556. X!         if (!(p = do_set(set_options, "autosign")) || !*p) {
  557. X!         char *home;
  558. X!         if (!(home = do_set(set_options, "home")) || !*home)
  559. X!             home = ALTERNATE_HOME;
  560. X!         (void) sprintf(buf, "%s/%s", home, SIGNATURE);
  561. X!         } else
  562. X!         (void) strcpy(buf, p);
  563. X!         wprint("Signing letter... ");
  564. X      } else
  565. X!         wprint("Using alternate signature... ");
  566. X!     fputs("\n-- \n", ed_fp), fflush(ed_fp);
  567. X!     (void) fseek(ed_fp, 0L, 2); /* guarantee position at end of file */
  568. X!     if (*buf == '$')
  569. X!         if (!(p = do_set(set_options, buf)))
  570. X!         wprint("(%s isn't set -- letter not signed)\n", buf);
  571. X!         else
  572. X!         fprintf(ed_fp, "%s\n", p), wprint("\n"), fflush(ed_fp);
  573. X!     else if (*buf == '\\')
  574. X!         fprintf(ed_fp, "%s\n", buf+1), wprint("\n"), fflush(ed_fp);
  575. X      else
  576. X!         file_to_fp(buf, ed_fp, "r");
  577. X!     }
  578. X  
  579. X      /* if fortune is set, check to see if fortunates is set. If so,
  580. X       * check to see if all the recipient are on the fortunates list.
  581. X*** OLD/main.c    Thu Apr  7 22:47:31 1988
  582. X--- main.c    Thu May 12 17:14:16 1988
  583. X***************
  584. X*** 25,32 ****
  585. X  char **argv;
  586. X  {
  587. X      u_long         flg = NO_FLG;
  588. X!     int            n, source_rc = TRUE;
  589. X!     char         f_flags[10], buf[256], *Cc = NULL, *Subj = NULL;
  590. X      register char  *p;
  591. X      char      **args;
  592. X  
  593. X--- 25,33 ----
  594. X  char **argv;
  595. X  {
  596. X      u_long         flg = NO_FLG;
  597. X!     int            n, source_rc = TRUE, src_n_exit;
  598. X!     char         f_flags[10], buf[256];
  599. X!     char       *Cc = NULL, *Subj = NULL, *src_file = NULL;
  600. X      register char  *p;
  601. X      char      **args;
  602. X  
  603. X***************
  604. X*** 93,98 ****
  605. X--- 94,100 ----
  606. X  #endif /* SUNTOOL */
  607. X          case 'S' : turnon(glob_flags, DO_SHELL);
  608. X          case 'f' :
  609. X+         case 'F' :
  610. X          case 'u' :
  611. X              if (args[1])
  612. X              args++;
  613. X***************
  614. X*** 147,153 ****
  615. X          else
  616. X              turnon(glob_flags, PRE_CURSES);
  617. X  #endif /* CURSES */
  618. X!         when 'N':
  619. X          (void) strcat(f_flags, "-N ");
  620. X          when 'r':
  621. X          (void) strcat(f_flags, "-r "); /* folder() argument */
  622. X--- 149,160 ----
  623. X          else
  624. X              turnon(glob_flags, PRE_CURSES);
  625. X  #endif /* CURSES */
  626. X!         when 'F':
  627. X!         src_n_exit = (argv[0][2] == '!');
  628. X!         if (!(src_file = *++argv))
  629. X!             puts("specify filename to source"), exit(1);
  630. X!         /* fall thru! */
  631. X!         case 'N':
  632. X          (void) strcat(f_flags, "-N ");
  633. X          when 'r':
  634. X          (void) strcat(f_flags, "-r "); /* folder() argument */
  635. X***************
  636. X*** 228,233 ****
  637. X--- 235,241 ----
  638. X      }
  639. X  
  640. X      if (source_rc) {
  641. X+     /* use cmd_line() in case DEFAULT_RC has expandable chars */
  642. X      (void) cmd_line(sprintf(buf, "source %s", DEFAULT_RC), msg_list);
  643. X      (void) source(0, DUBL_NULL);
  644. X      }
  645. X***************
  646. X*** 322,328 ****
  647. X      }
  648. X  
  649. X      /* find a free tmpfile */
  650. X!     if (!(p = do_set(set_options, "home")) || !*p)
  651. X  alted:
  652. X      p = ALTERNATE_HOME;
  653. X      flg = getpid();
  654. X--- 330,337 ----
  655. X      }
  656. X  
  657. X      /* find a free tmpfile */
  658. X!     if (!(p = do_set(set_options, "tmpdir")) &&
  659. X!     !(p = do_set(set_options, "home")))
  660. X  alted:
  661. X      p = ALTERNATE_HOME;
  662. X      flg = getpid();
  663. X***************
  664. X*** 348,354 ****
  665. X      (void) signal(SIGQUIT, catch);
  666. X      (void) signal(SIGHUP,  catch);
  667. X  
  668. X!     if (!hdrs_only && !istool && !do_set(set_options, "quiet"))
  669. X      printf("%s: Type '?' for help.\n", VERSION);
  670. X  
  671. X      (void) sprintf(buf, "folder %s %s", f_flags, mailfile);
  672. X--- 357,364 ----
  673. X      (void) signal(SIGQUIT, catch);
  674. X      (void) signal(SIGHUP,  catch);
  675. X  
  676. X!     if (!hdrs_only && !istool && (!src_file || !src_n_exit) &&
  677. X!     !do_set(set_options, "quiet"))
  678. X      printf("%s: Type '?' for help.\n", VERSION);
  679. X  
  680. X      (void) sprintf(buf, "folder %s %s", f_flags, mailfile);
  681. X***************
  682. X*** 368,373 ****
  683. X--- 378,392 ----
  684. X      turnon(glob_flags, DO_SHELL);
  685. X      if (istool && msg_cnt)
  686. X      set_isread(current_msg);
  687. X+ 
  688. X+     /* finally, if the user wanted to source a file to execute, do it now */
  689. X+     if (src_file) {
  690. X+     char *s_argv[2];
  691. X+     s_argv[1] = src_file;
  692. X+     (void) source(2, s_argv);
  693. X+     if (!istool && src_n_exit)
  694. X+         cleanup(0);
  695. X+     }
  696. X  
  697. X  #ifdef SUNTOOL
  698. X      if (istool) {
  699. X*** OLD/makefile.bsd    Thu Apr  7 22:47:37 1988
  700. X--- makefile.bsd    Wed May 11 15:53:44 1988
  701. X***************
  702. X*** 7,13 ****
  703. X  OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  704. X        signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  705. X        folders.o dates.o loop.o help.o viewopts.o curses.o curs_io.o bind.o
  706. X! HELP_FILES= README-6.0 README cmd_help mush.1
  707. X  MAKES= makefile.bsd makefile.x286 makefile.x386 makefile.sys.v
  708. X  
  709. X  CFLAGS= -O -DCURSES -DBSD
  710. X--- 7,15 ----
  711. X  OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  712. X        signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  713. X        folders.o dates.o loop.o help.o viewopts.o curses.o curs_io.o bind.o
  714. X! 
  715. X! HELP_FILES= README README-6.0 README-6.1 README-6.2 mush.1 cmd_help
  716. X! 
  717. X  MAKES= makefile.bsd makefile.x286 makefile.x386 makefile.sys.v
  718. X  
  719. X  CFLAGS= -O -DCURSES -DBSD
  720. X*** OLD/makefile.sun    Thu Apr  7 22:47:40 1988
  721. X--- makefile.sun    Wed May 11 15:53:25 1988
  722. X***************
  723. X*** 17,23 ****
  724. X  IMAGES= mail.icon.1 mail.icon.2 check.pr cycle.pr envelope.pr glasses.pr \
  725. X      write.pr up.arrow.pr dn.arrow.pr coffee.cup.pr
  726. X  
  727. X! HELP_FILES= README-6.0 README cmd_help tool_help mush.1
  728. X  
  729. X  MAKES= makefile.sun makefile.bsd makefile.sys.v makefile.x286 makefile.x386
  730. X  
  731. X--- 17,23 ----
  732. X  IMAGES= mail.icon.1 mail.icon.2 check.pr cycle.pr envelope.pr glasses.pr \
  733. X      write.pr up.arrow.pr dn.arrow.pr coffee.cup.pr
  734. X  
  735. X! HELP_FILES= README README-6.0 README-6.1 README-6.2 mush.1 cmd_help tool_help
  736. X  
  737. X  MAKES= makefile.sun makefile.bsd makefile.sys.v makefile.x286 makefile.x386
  738. X  
  739. X*** OLD/makefile.x286    Tue Apr 12 22:00:18 1988
  740. X--- makefile.x286    Wed May 11 15:54:23 1988
  741. X***************
  742. X*** 10,16 ****
  743. X  OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  744. X        signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  745. X        folders.o dates.o loop.o help.o viewopts.o bind.o curses.o curs_io.o
  746. X! DOCS= README cmd_help mush.1
  747. X  MAKES= makefile.sys.v makefile.xenix makefile.bsd
  748. X  
  749. X  CFLAGS= -O -DSYSV -Mle -DCURSES -DREGCMP -DUSG
  750. X--- 10,16 ----
  751. X  OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  752. X        signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  753. X        folders.o dates.o loop.o help.o viewopts.o bind.o curses.o curs_io.o
  754. X! HELP_FILES= README README-6.0 README-6.1 README-6.2 mush.1 cmd_help
  755. X  MAKES= makefile.sys.v makefile.xenix makefile.bsd
  756. X  
  757. X  CFLAGS= -O -DSYSV -Mle -DCURSES -DREGCMP -DUSG
  758. X***************
  759. X*** 28,34 ****
  760. X      cc $(CFLAGS) -LARGE -c bind.c
  761. X  
  762. X  shar:
  763. X!     shar ${DOCS} ${MAKES} ${HDRS}>hdr.shr
  764. X      shar ${SRCS1} > src1.shr
  765. X      shar ${SRCS2} > src2.shr
  766. X      shar ${SRCS3} > src3.shr
  767. X--- 28,34 ----
  768. X      cc $(CFLAGS) -LARGE -c bind.c
  769. X  
  770. X  shar:
  771. X!     shar ${HELP_FILES} ${MAKES} ${HDRS}>hdr.shr
  772. X      shar ${SRCS1} > src1.shr
  773. X      shar ${SRCS2} > src2.shr
  774. X      shar ${SRCS3} > src3.shr
  775. X***************
  776. X*** 39,45 ****
  777. X      shar ${SRCS8} > src8.shr
  778. X  
  779. X  tar:
  780. X!     tar fcv MUSH ${MAKES} ${HDRS} ${DOCS} ${SRCS1} \
  781. X      ${SRCS2} ${SRCS3} ${SRCS4} ${SRCS5} ${SRCS6} ${SRCS7} ${SRCS}8
  782. X  
  783. X  clean:
  784. X--- 39,45 ----
  785. X      shar ${SRCS8} > src8.shr
  786. X  
  787. X  tar:
  788. X!     tar fcv MUSH ${MAKES} ${HDRS} ${HELP_FILES} ${SRCS1} \
  789. X      ${SRCS2} ${SRCS3} ${SRCS4} ${SRCS5} ${SRCS6} ${SRCS7} ${SRCS}8
  790. X  
  791. X  clean:
  792. X*** OLD/makefile.x386    Tue Apr 12 21:59:57 1988
  793. X--- makefile.x386    Wed May 11 15:54:42 1988
  794. X***************
  795. X*** 10,16 ****
  796. X  OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  797. X        signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  798. X        folders.o dates.o loop.o help.o viewopts.o bind.o curses.o curs_io.o
  799. X! DOCS= README cmd_help mush.1
  800. X  MAKES= makefile.sys.v makefile.xenix makefile.bsd
  801. X  
  802. X  CFLAGS= -O -DSYSV -M3e -DCURSES -DREGCMP -DUSG 
  803. X--- 10,16 ----
  804. X  OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  805. X        signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  806. X        folders.o dates.o loop.o help.o viewopts.o bind.o curses.o curs_io.o
  807. X! HELP_FILES= README README-6.0 README-6.1 README-6.2 mush.1 cmd_help
  808. X  MAKES= makefile.sys.v makefile.xenix makefile.bsd
  809. X  
  810. X  CFLAGS= -O -DSYSV -M3e -DCURSES -DREGCMP -DUSG 
  811. X***************
  812. X*** 25,31 ****
  813. X      cc $(CFLAGS) -LARGE -c bind.c
  814. X  
  815. X  shar:
  816. X!     shar ${DOCS} ${MAKES} ${HDRS}>hdr.shr
  817. X      shar ${SRCS1} > src1.shr
  818. X      shar ${SRCS2} > src2.shr
  819. X      shar ${SRCS3} > src3.shr
  820. X--- 25,31 ----
  821. X      cc $(CFLAGS) -LARGE -c bind.c
  822. X  
  823. X  shar:
  824. X!     shar ${HELP_FILES} ${MAKES} ${HDRS}>hdr.shr
  825. X      shar ${SRCS1} > src1.shr
  826. X      shar ${SRCS2} > src2.shr
  827. X      shar ${SRCS3} > src3.shr
  828. X***************
  829. X*** 36,42 ****
  830. X      shar ${SRCS8} > src8.shr
  831. X  
  832. X  tar:
  833. X!     tar fcv MUSH ${MAKES} ${HDRS} ${DOCS} ${SRCS1} \
  834. X      ${SRCS2} ${SRCS3} ${SRCS4} ${SRCS5} ${SRCS6} ${SRCS7} ${SRCS8}
  835. X  
  836. X  clean:
  837. X--- 36,42 ----
  838. X      shar ${SRCS8} > src8.shr
  839. X  
  840. X  tar:
  841. X!     tar fcv MUSH ${MAKES} ${HDRS} ${HELP_FILES} ${SRCS1} \
  842. X      ${SRCS2} ${SRCS3} ${SRCS4} ${SRCS5} ${SRCS6} ${SRCS7} ${SRCS8}
  843. X  
  844. X  clean:
  845. X*** OLD/misc.c    Thu Apr  7 22:47:54 1988
  846. X--- misc.c    Wed May 11 14:01:36 1988
  847. X***************
  848. X*** 354,363 ****
  849. X      turnon(glob_flags, IGN_SIGS);
  850. X      if (!buf)
  851. X          pp = stdout;
  852. X!     else if (!(pp = popen(buf, "w")))
  853. X!         error(buf);
  854. X!     else
  855. X          echo_on();
  856. X      cnt = 0;
  857. X      } else if (!buf) {
  858. X      if (pp && pp != stdout)
  859. X--- 354,364 ----
  860. X      turnon(glob_flags, IGN_SIGS);
  861. X      if (!buf)
  862. X          pp = stdout;
  863. X!     else {
  864. X          echo_on();
  865. X+         if (!(pp = popen(buf, "w")))
  866. X+         error(buf);
  867. X+     }
  868. X      cnt = 0;
  869. X      } else if (!buf) {
  870. X      if (pp && pp != stdout)
  871. X*** OLD/mush.1    Wed Apr  6 00:34:07 1988
  872. X--- mush.1    Thu May 12 17:08:32 1988
  873. X***************
  874. X*** 60,65 ****
  875. X--- 60,70 ----
  876. X  .B \-f
  877. X  [ folder ]
  878. X  ]
  879. X+ [
  880. X+ .B \-F
  881. X+ [!]
  882. X+ [ file ]
  883. X+ ]
  884. X  .br
  885. X  .B mush
  886. X  [
  887. X***************
  888. X*** 126,131 ****
  889. X--- 131,140 ----
  890. X  .B \-f
  891. X  [ folder ]
  892. X  ]
  893. X+ [
  894. X+ .B \-F
  895. X+ [ file ]
  896. X+ ]
  897. X  .br
  898. X  .B mush
  899. X  [
  900. X***************
  901. X*** 218,223 ****
  902. X--- 227,244 ----
  903. X  .B debug
  904. X  command.
  905. X  .TP
  906. X+ \-F[!] filename
  907. X+ This file is the same type as the initialization file read on startup
  908. X+ (see INITIALIZATION) with the exception that commands which manipulate
  909. X+ or search messages may be given.  Normally, such commands may not exist
  910. X+ in the initialization file since that file is read before the folder
  911. X+ is scanned.  This file is read after the folder is scanned, so commands
  912. X+ which change folders are allowed.
  913. X+ The optional `!' argument prevents the shell from running after the file
  914. X+ has been sourced.  Otherwise,
  915. X+ .I Mush
  916. X+ continues into whatever interface has been specified.
  917. X+ .TP
  918. X  \-f [ filename ]
  919. X  The optional filename argument specifies a folder containing mail messages.
  920. X  With no argument,
  921. X***************
  922. X*** 2069,2091 ****
  923. X  Options:
  924. X  .ta 1.5i
  925. X  .in +2
  926. X! \-d [\-]date    messages sent on or after [`\-' before] date
  927. X! \-f    search for pattern in \*QFrom\*U field only
  928. X! \-h header    search for pattern in specified header only
  929. X! \-i    ignore case of letters when searching
  930. X! \-r msg_list    search only the listed messages
  931. X! \-s    search for pattern in \*QSubject\*U field only
  932. X! \-t    search for pattern in \*QTo\*U field only
  933. X! \-x    select messages not containing the pattern
  934. X  .in -2
  935. X  .fi
  936. X  .sp
  937. X! Only one of \-d, \-f, \-h, \-s and \-t can be specified at once.
  938. X  Entire messages are scanned for the <pattern>
  939. X! unless \-f, \-h, \-s or \-t is specified.
  940. X  Messages marked for deletion are also searched.
  941. X! No patterns can be specified with the \-d option,
  942. X! and the \-x option may not be used with \-d.
  943. X  .sp
  944. X  For the \-d option, \*Qdate\*U is of the form:
  945. X  .sp
  946. X--- 2090,2112 ----
  947. X  Options:
  948. X  .ta 1.5i
  949. X  .in +2
  950. X! \-d [+-]date    messages sent on or [+ after] [`\-' before] date.
  951. X! \-ago <format>    search for messages relative to today's date.
  952. X! \-f    search for pattern in \*QFrom\*U field only.
  953. X! \-i    ignore case of letters when searching.
  954. X! \-r msg_list    search only the listed messages.
  955. X! \-s    search for pattern in \*QSubject\*U field only.
  956. X! \-t    search for pattern in \*QTo\*U field only.
  957. X! \-h header    search for pattern in specified header only.
  958. X! \-x    select messages not containing the pattern.
  959. X  .in -2
  960. X  .fi
  961. X  .sp
  962. X! Only one of \-d, \-a, \-f, \-h, \-s and \-t can be specified at once.
  963. X  Entire messages are scanned for the <pattern>
  964. X! unless \-d, \-a, \-f, \-h, \-s or \-t is specified.
  965. X  Messages marked for deletion are also searched.
  966. X! No patterns can be specified with the \-d or \-a options.
  967. X  .sp
  968. X  For the \-d option, \*Qdate\*U is of the form:
  969. X  .sp
  970. X***************
  971. X*** 2100,2108 ****
  972. X  .in +2
  973. X  .ta 2.0i
  974. X  .sp
  975. X! pick \-d 4/20    on or after April 20, this year
  976. X! pick \-d \-/2/85    on or before the 2nd, this month, 1985
  977. X! pick \-d /    today only
  978. X  .fi
  979. X  .in -2
  980. X  .sp
  981. X--- 2121,2130 ----
  982. X  .in +2
  983. X  .ta 2.0i
  984. X  .sp
  985. X! pick \-d 4/20    on April 20, this year.
  986. X! pick \-d \-/2/85    on or before the 2nd, this month, 1985.
  987. X! pick \-d +5/4    on or after May 4 of this year.
  988. X! pick \-d /    today only.
  989. X  .fi
  990. X  .in -2
  991. X  .sp
  992. X***************
  993. X*** 2109,2114 ****
  994. X--- 2131,2159 ----
  995. X  At least one `/' char must be used in a date.
  996. X  There is no strong date checking; 2/30 would be considered a valid date.
  997. X  .sp
  998. X+ For the \-ago option, the format is very simple.  Specify the number of
  999. X+ days followed by the word \*Qdays\*U, or the number of weeks followed by
  1000. X+ the word \*Qweeks\*U, and so on with months and years.  Truncation is allowed,
  1001. X+ since only the first character is examined, so all of the following are
  1002. X+ equivalent:
  1003. X+ .sp
  1004. X+ .in +2
  1005. X+ pick -ago 1 day, 2 weeks
  1006. X+ pick -ago 2Weeks 1Day
  1007. X+ pick -ago 2w,1day
  1008. X+ pick -a 2w1d
  1009. X+ .in -2
  1010. X+ These examples will find all messages that are exactly 2 weeks and 1 day
  1011. X+ old.  All \*Qago\*U dates collapse into \*Qday\*U time segments.  This
  1012. X+ means that months are 30.5 days long.  If more precise date selection is
  1013. X+ required, use the \-d option and specify specific dates.
  1014. X+ .sp
  1015. X+ Also note that the -ago option allows the \*Qbefore\*U (-) and \*Qafter\*U (+)
  1016. X+ arguments.  Thus, you may pick for all messages older than 1 week with:
  1017. X+ .sp
  1018. X+ .ti +2
  1019. X+ pick -ago -1 week
  1020. X+ .sp
  1021. X  Other examples of
  1022. X  .B pick:
  1023. X  .sp
  1024. X***************
  1025. X*** 2116,2127 ****
  1026. X  pick \-d 2/5/86 | pick \-d \-2/5/87 | pick \-s "mail stuff" | lpr
  1027. X  .sp
  1028. X  will find all the messages between the dates February 5, 1986 and
  1029. X! February 5, 1987 that contain the subject "mail stuff" and print them.
  1030. X  .sp
  1031. X  .ti +2
  1032. X  pick -s Re: | delete
  1033. X  .sp
  1034. X! deletes messages that have \*QRe:\*U in the subject
  1035. X  .sp
  1036. X  .ti +2
  1037. X  folder +project | pick -f frank
  1038. X--- 2161,2173 ----
  1039. X  pick \-d 2/5/86 | pick \-d \-2/5/87 | pick \-s "mail stuff" | lpr
  1040. X  .sp
  1041. X  will find all the messages between the dates February 5, 1986 and
  1042. X! February 5, 1987 that contain the subject "mail stuff" and send them
  1043. X! to the printer.
  1044. X  .sp
  1045. X  .ti +2
  1046. X  pick -s Re: | delete
  1047. X  .sp
  1048. X! deletes messages that have \*QRe:\*U in the Subject header.
  1049. X  .sp
  1050. X  .ti +2
  1051. X  folder +project | pick -f frank
  1052. X***************
  1053. X*** 2135,2140 ****
  1054. X--- 2181,2192 ----
  1055. X  if the string \*Qucbvax\*U is in the header.
  1056. X  Note that case sensitivity
  1057. X  applies only to the pattern searched, not the header itself.
  1058. X+ .sp
  1059. X+ .ti +2
  1060. X+ pick -ago +1w | save +current
  1061. X+ .sp
  1062. X+ This finds all messages that are a week or less old and saves them in the file
  1063. X+ called \fIcurrent\fR, which is found in the user's \fIfolder\fR variable.
  1064. X  .TP
  1065. X  .B preserve
  1066. X  .RB ( pre )
  1067. X***************
  1068. X*** 3287,3292 ****
  1069. X--- 3339,3353 ----
  1070. X  (Boolean)
  1071. X  Whenever messages are read, piped, or saved, if this variable is set,
  1072. X  all consecutive blank lines are squeezed into one blank line.
  1073. X+ .TP
  1074. X+ .B tmpdir
  1075. X+ (String)
  1076. X+ This variable describes the path to use as the directory to use
  1077. X+ for all tempfiles that
  1078. X+ .I Mush
  1079. X+ uses.  By default, the user's home directory is used.  If that
  1080. X+ cannot be accessed, a directory writable by all is used (typically, /tmp).
  1081. X+ If \fBtmpdir\fR is set, then it is used first.
  1082. X  .TP
  1083. X  .B toplines
  1084. X  (Numeric)
  1085. X*** OLD/mush.h    Thu May 12 13:52:11 1988
  1086. X--- mush.h    Wed May 11 15:19:26 1988
  1087. X***************
  1088. X*** 1,6 ****
  1089. X  /* @(#)mush.h    (c) copyright 1986 (Dan Heller) */
  1090. X  
  1091. X! #define VERSION "Mail User's Shell (6.1 4/26/88)"
  1092. X  
  1093. X  #include "config.h"
  1094. X  
  1095. X--- 1,6 ----
  1096. X  /* @(#)mush.h    (c) copyright 1986 (Dan Heller) */
  1097. X  
  1098. X! #define VERSION "Mail User's Shell (6.2 5/11/88)"
  1099. X  
  1100. X  #include "config.h"
  1101. X  
  1102. X*** OLD/pick.c    Tue Mar  1 14:59:20 1988
  1103. X--- pick.c    Wed May 11 15:51:46 1988
  1104. X***************
  1105. X*** 2,9 ****
  1106. X  
  1107. X  #include "mush.h"
  1108. X  
  1109. X! static int before, mdy[3], search_from, search_subj, search_to, xflg, icase;
  1110. X! static search_hdr[64];
  1111. X  
  1112. X  do_pick(n, argv, list)
  1113. X  register int n;
  1114. X--- 2,9 ----
  1115. X  
  1116. X  #include "mush.h"
  1117. X  
  1118. X! static int before, after, search_from, search_subj, search_to, xflg, icase;
  1119. X! static mdy[3], search_hdr[64];
  1120. X  
  1121. X  do_pick(n, argv, list)
  1122. X  register int n;
  1123. X***************
  1124. X*** 38,45 ****
  1125. X  register char **argv, list[];
  1126. X  {
  1127. X      register char c;
  1128. X!     int o_before = before, o_mdy[3], o_search_from = search_from,
  1129. X!     o_search_subj = search_subj, o_search_to = search_to, o_xflg = xflg, n;
  1130. X  
  1131. X      for (c = 0; c < 3; c++)
  1132. X      o_mdy[c] = mdy[c];
  1133. X--- 38,46 ----
  1134. X  register char **argv, list[];
  1135. X  {
  1136. X      register char c;
  1137. X!     int o_before = before, o_after = after, o_search_from = search_from,
  1138. X!     o_search_subj = search_subj, o_search_to = search_to, o_xflg = xflg,
  1139. X!     o_mdy[3], n;
  1140. X  
  1141. X      for (c = 0; c < 3; c++)
  1142. X      o_mdy[c] = mdy[c];
  1143. X***************
  1144. X*** 50,56 ****
  1145. X      goto bad;
  1146. X      }
  1147. X  
  1148. X!     icase = before = search_from = search_subj = xflg = 0;
  1149. X      mdy[0] = search_hdr[0] = 0;
  1150. X      while (*argv && *++argv && **argv == '-')
  1151. X      switch(c = argv[0][1]) {
  1152. X--- 51,57 ----
  1153. X      goto bad;
  1154. X      }
  1155. X  
  1156. X!     icase = before = after = search_from = search_subj = xflg = 0;
  1157. X      mdy[0] = search_hdr[0] = 0;
  1158. X      while (*argv && *++argv && **argv == '-')
  1159. X      switch(c = argv[0][1]) {
  1160. X***************
  1161. X*** 76,81 ****
  1162. X--- 77,88 ----
  1163. X              goto bad;
  1164. X          argv += (n-1); /* we're going to increment another up top */
  1165. X          }
  1166. X+         when 'a': {
  1167. X+         int n = ago_date(++argv);
  1168. X+         if (n == -1)
  1169. X+             goto bad;
  1170. X+         argv += n;
  1171. X+         }
  1172. X          when 'd':
  1173. X          if (!*++argv) {
  1174. X              print("specify a date for -%c\n", c);
  1175. X***************
  1176. X*** 108,129 ****
  1177. X      }
  1178. X      if (verbose) {
  1179. X      print_more("Searching for messages");
  1180. X!     if (mdy[1] == 0)
  1181. X          print(" that %s \"%s\"", (xflg)? "doesn't contain": "contains",
  1182. X                  (*argv)? *argv: "<previous expression>");
  1183. X!     if (search_subj)
  1184. X!         print_more(" in subject line");
  1185. X!     else if (search_from)
  1186. X!         print_more(" from author names");
  1187. X!     else if (search_to)
  1188. X!         print_more(" from the To: field");
  1189. X!     else if (search_hdr[0])
  1190. X!         print_more(" from the message header: \"%s:\"", search_hdr);
  1191. X!     if (mdy[1] > 0) {
  1192. X          extern char *month_names[]; /* from dates.c */
  1193. X!         print_more(" dated on or %s %s. %d, 19%d.",
  1194. X!           (before)? "before": "after",
  1195. X!           month_names[mdy[0]], mdy[1], mdy[2]);
  1196. X      }
  1197. X      print_more("\n");
  1198. X      }
  1199. X--- 115,138 ----
  1200. X      }
  1201. X      if (verbose) {
  1202. X      print_more("Searching for messages");
  1203. X!     if (mdy[1] == 0) {
  1204. X          print(" that %s \"%s\"", (xflg)? "doesn't contain": "contains",
  1205. X                  (*argv)? *argv: "<previous expression>");
  1206. X!         if (search_subj)
  1207. X!         print_more(" in subject line");
  1208. X!         else if (search_from)
  1209. X!         print_more(" from author names");
  1210. X!         else if (search_to)
  1211. X!         print_more(" from the To: field");
  1212. X!         else if (search_hdr[0])
  1213. X!         print_more(" from the message header: \"%s:\"", search_hdr);
  1214. X!     } else {
  1215. X          extern char *month_names[]; /* from dates.c */
  1216. X!         print_more(" dated ");
  1217. X!         if (before || after)
  1218. X!         print_more("on or %s ", (before)? "before": "after");
  1219. X!         print_more("%s. %d, 19%d.",
  1220. X!               month_names[mdy[0]], mdy[1], mdy[2]);
  1221. X      }
  1222. X      print_more("\n");
  1223. X      }
  1224. X***************
  1225. X*** 131,137 ****
  1226. X      print("using date: -i flag ignored.\n");
  1227. X      ret = find_pattern(*argv, list);
  1228. X  bad:
  1229. X!     before = o_before, search_from = o_search_from;
  1230. X      search_subj = o_search_subj, search_to = o_search_to, xflg = o_xflg;
  1231. X      for (c = 0; c < 3; c++)
  1232. X      mdy[c] = o_mdy[c];
  1233. X--- 140,146 ----
  1234. X      print("using date: -i flag ignored.\n");
  1235. X      ret = find_pattern(*argv, list);
  1236. X  bad:
  1237. X!     before = o_before, after = o_after, search_from = o_search_from;
  1238. X      search_subj = o_search_subj, search_to = o_search_to, xflg = o_xflg;
  1239. X      for (c = 0; c < 3; c++)
  1240. X      mdy[c] = o_mdy[c];
  1241. X***************
  1242. X*** 197,204 ****
  1243. X           */
  1244. X          for (i = 2; i < 5; i++)
  1245. X              if (before && msg_mdy[i%3] < mdy[i%3]
  1246. X!             || !before && msg_mdy[i%3] > mdy[i%3]
  1247. X!             || i == 4 && (msg_mdy[i%3] == mdy[i%3])) {
  1248. X                  Debug("matched (%s).\n",
  1249. X                  (i == 2)? "year" : (i == 3)? "month" : "day");
  1250. X                  break;
  1251. X--- 206,213 ----
  1252. X           */
  1253. X          for (i = 2; i < 5; i++)
  1254. X              if (before && msg_mdy[i%3] < mdy[i%3]
  1255. X!             ||  after  && msg_mdy[i%3] > mdy[i%3]
  1256. X!             ||  i == 4 && (msg_mdy[i%3] == mdy[i%3])) {
  1257. X                  Debug("matched (%s).\n",
  1258. X                  (i == 2)? "year" : (i == 3)? "month" : "day");
  1259. X                  break;
  1260. X***************
  1261. X*** 373,380 ****
  1262. X      int       i;
  1263. X      struct tm       *today;
  1264. X  
  1265. X!     if (*p == '-') {
  1266. X!     before = 1;
  1267. X      skipspaces(1);
  1268. X      }
  1269. X      if (!isdigit(*p) && *p != '/') {
  1270. X--- 382,389 ----
  1271. X      int       i;
  1272. X      struct tm       *today;
  1273. X  
  1274. X!     if (*p == '-' || *p == '+') {
  1275. X!     before = !(after = *p == '+');
  1276. X      skipspaces(1);
  1277. X      }
  1278. X      if (!isdigit(*p) && *p != '/') {
  1279. X***************
  1280. X*** 406,409 ****
  1281. X--- 415,484 ----
  1282. X          p++;
  1283. X      }
  1284. X      return 1;
  1285. X+ }
  1286. X+ 
  1287. X+ /*
  1288. X+  * Parse arguments specifying days/months/years "ago" (relative to today).
  1289. X+  * Legal syntax: -ago [+-][args]
  1290. X+  *    where "args" is defined to be:
  1291. X+  *    [0-9]+[ ]*[dD][a-Z]*[ ,]*[0-9]+[mM][a-Z]*[ ,]*[0-9]+[ ]*[yY][a-Z]*
  1292. X+  *    1 or more digits, 0 or more spaces, d or D followed by 0 or more chars,
  1293. X+  *    0 or more whitespaces or commas, repeat for months and years...
  1294. X+  * Examples:
  1295. X+  *    1 day, 2 months, 0 years
  1296. X+  *    2 weeks 1 year
  1297. X+  *    10d, 5m
  1298. X+  *    3w
  1299. X+  *    1d 1Y
  1300. X+  *
  1301. X+  * Return number of args parsed; -1 on error.
  1302. X+  */
  1303. X+ ago_date(argv)
  1304. X+ char **argv;
  1305. X+ {
  1306. X+ #define SECS_PER_DAY   (60 * 60 * 24)
  1307. X+ #define SECS_PER_WEEK  (SECS_PER_DAY * 7)
  1308. X+ #define SECS_PER_MONTH ((int)(SECS_PER_DAY * 30.5))
  1309. X+ #define SECS_PER_YEAR  (SECS_PER_DAY * 365)
  1310. X+     register char *p;
  1311. X+     char       buf[256];
  1312. X+     int           n = 0, value, mdy_index = 0;
  1313. X+     long       t;
  1314. X+     struct tm       *today;
  1315. X+ 
  1316. X+     (void) argv_to_string(buf, argv);
  1317. X+     p = buf;
  1318. X+     (void) time (&t); /* get current time in seconds and subtract new values */
  1319. X+     if (*p == '-')
  1320. X+     before = TRUE;
  1321. X+     else if (*p == '+')
  1322. X+     after = TRUE;
  1323. X+     skipspaces(before || after);
  1324. X+     while (*p) {
  1325. X+     if (!isdigit(*p))
  1326. X+         break; /* really a syntax error, but it could be other pick ars */
  1327. X+     p = my_atoi(p, &value); /* get 1 or more digits */
  1328. X+     skipspaces(0); /* 0 or more spaces */
  1329. X+     switch (lower(*p)) {   /* d, m, or y */
  1330. X+         when 'd' : t -= value * SECS_PER_DAY;
  1331. X+         when 'w' : t -= value * SECS_PER_WEEK;
  1332. X+         when 'm' : t -= value * SECS_PER_MONTH;
  1333. X+         when 'y' : t -= value * SECS_PER_YEAR;
  1334. X+         otherwise: return -1;
  1335. X+     }
  1336. X+     for (p++; Lower(*p) >= 'a' && *p <= 'z'; p++)
  1337. X+         ; /* skip the rest of this token */
  1338. X+     while (*p == ',' || isspace(*p))
  1339. X+         ; /* 0 or more whitespaces or commas */
  1340. X+     }
  1341. X+     today = localtime(&t);
  1342. X+     mdy[0] = today->tm_mon;
  1343. X+     mdy[1] = today->tm_mday;
  1344. X+     mdy[2] = today->tm_year;
  1345. X+ 
  1346. X+     /* Count the number of args parsed */
  1347. X+     for (n = 0; p > buf && *argv; n++)
  1348. X+     p -= (strlen(*argv++)+1);
  1349. X+     Debug("parsed %d args\n", n);
  1350. X+     return n;
  1351. X  }
  1352. X*** OLD/print.c    Thu May 12 13:52:13 1988
  1353. X--- print.c    Thu Apr 28 21:47:54 1988
  1354. X***************
  1355. X*** 1,4 ****
  1356. X- 
  1357. X  /* @(#)print.c    2.4    (c) copyright 10/15/86 (Dan Heller) */
  1358. X  
  1359. X  #include "mush.h"
  1360. X--- 1,3 ----
  1361. X***************
  1362. X*** 185,188 ****
  1363. X  {
  1364. X      print("");
  1365. X  }
  1366. X- 
  1367. X--- 184,186 ----
  1368. X*** OLD/strings.c    Thu Apr  7 09:51:46 1988
  1369. X--- strings.c    Tue Apr 26 19:01:20 1988
  1370. X***************
  1371. X*** 219,229 ****
  1372. X  }
  1373. X  
  1374. X  #ifdef SYSV
  1375. X  char *
  1376. X! Sprintf(buf, fmt, args)
  1377. X  register char *buf, *fmt;
  1378. X  {
  1379. X!     vsprintf(buf, fmt, &args);
  1380. X      return buf;
  1381. X  }
  1382. X  #endif /* SYSV */
  1383. X--- 219,247 ----
  1384. X  }
  1385. X  
  1386. X  #ifdef SYSV
  1387. X+ #include <varargs.h>
  1388. X  char *
  1389. X! Sprintf(buf, fmt, va_alist)
  1390. X  register char *buf, *fmt;
  1391. X+ va_dcl
  1392. X  {
  1393. X!     va_list ap;
  1394. X! #ifdef VPRINTF
  1395. X!     va_start(ap);
  1396. X!     (void) vsprintf(buf, fmt, ap);
  1397. X!     va_end(ap);
  1398. X! #else
  1399. X!     {
  1400. X!     FILE foo;
  1401. X!     foo._cnt = BUFSIZ;
  1402. X!     foo._base = foo._ptr = buf; /* may have to be cast (unsigned char *) */
  1403. X!     foo._flag = _IOWRT+_IOSTRG;
  1404. X!     va_start(ap);
  1405. X!     (void) _doprnt(fmt, ap, &foo);
  1406. X!     va_end(ap);
  1407. X!     *foo._ptr = '\0'; /* plant terminating null character */
  1408. X!     }
  1409. X! #endif /* VPRINTF */
  1410. X      return buf;
  1411. X  }
  1412. X  #endif /* SYSV */
  1413. X*** OLD/viewopts.c    Sat Apr  2 21:12:48 1988
  1414. X--- viewopts.c    Wed May 11 20:48:41 1988
  1415. X***************
  1416. X*** 129,134 ****
  1417. X--- 129,136 ----
  1418. X        "When reading messages, squeeze all blank lines into one." },
  1419. X      { "top", "Lines", TOOL | TEXT,
  1420. X        "Number of lines to print of a message for the 'top' command."  },
  1421. X+     { "tmpdir", "Directory", TOOL | TEXT,
  1422. X+       "Directory to use for temporary files used by Mush." },
  1423. X      { "unix", NULL, TEXT,
  1424. X        "Non-mush commands are considered to be UNIX commands." },
  1425. X      { "verify", NULL, TEXT,
  1426. END_OF_FILE
  1427. if test 38618 -ne `wc -c <'Diffs-6.2'`; then
  1428.     echo shar: \"'Diffs-6.2'\" unpacked with wrong size!
  1429. fi
  1430. # end of 'Diffs-6.2'
  1431. fi
  1432. echo shar: End of shell archive.
  1433. exit 0
  1434.